<?php 
namespace app\admin\controller;

use app\admin\Controller;
use think\Request;

Class Block extends Controller{
	public function index(){

		if($this->request->isAjax()){
			$post=$this->request->post();
			$data=[];			        
			$data[$post['t1']]=$post['c1'];
			$data[$post['t2']]=$post['c2'];
			$data[$post['t3']]=$post['c3'];
			$data[$post['t4']]=$post['c4'];
			$info=serialize($data);			        
			file_put_contents('./static/admin/data/block.data',$info);
			return ajax_return_adv('修改成功','current');
		}else{
			$arr = unserialize(file_get_contents('./static/admin/data/block.data'));
			$title=array_keys($arr);
			$content=array_values($arr); 
			$this->view->assign(['title'=>$title,'content'=>$content]);
		}
		
		return $this->view->fetch();
	}
}

